package com.typy.www.tpay.ui.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ListView;

import com.typy.www.tpay.bean.vm.BankCardVm;
import com.typy.www.tpay.ui.itemview.BankCardItemView;

import java.util.List;

/**
 * Created by 13799 on 2018/6/28.
 */

public class BankCardAdapter extends BaseAdapter {

    private Context mContext;
    private List<BankCardVm> list;
    private int classType;

    public int getClassType() {
        return classType;
    }

    public void setClassType(int classType) {
        this.classType = classType;
    }

    public BankCardAdapter(Context context){
        mContext=context;
    }

    public void setList(List<BankCardVm> list) {
        this.list = list;
    }

    @Override
    public int getCount() {
        return list==null?0:list.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        BankCardItemView itemView=null;
        if(convertView==null){
            itemView=new BankCardItemView(mContext);
            convertView=itemView.getView();
            convertView.setTag(itemView);
        }else{
            itemView= (BankCardItemView) convertView.getTag();
        }
        itemView.bind(list.get(position),position,classType);
        return convertView;
    }
}
